# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-plasma
pkgname=xdg-desktop-portal-kde
pkgver=5.27.10
pkgrel=0
pkgdesc="A backend implementation for xdg-desktop-portal that is using Qt/KDE"
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://phabricator.kde.org/source/xdg-desktop-portal-kde"
license="LGPL-2.0-or-later"
depends="xdg-desktop-portal"
makedepends="
	cups-dev
	extra-cmake-modules
	glib-dev
	kcoreaddons5-dev
	kdeclarative5-dev
	kio5-dev
	kirigami2-dev
	kwayland5-dev
	libepoxy-dev
	pipewire-dev
	plasma-framework5-dev
	plasma-wayland-protocols
	qt5-qtbase-dev
	samurai
	xdg-desktop-portal-dev
	"
subpackages="$pkgname-lang"

case "$pkgver" in
	*.90*) _rel=unstable;;
	*) _rel=stable;;
esac
_repo_url="https://invent.kde.org/plasma/xdg-desktop-portal-kde.git"
source="https://download.kde.org/$_rel/plasma/$pkgver/xdg-desktop-portal-kde-$pkgver.tar.xz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DKDE_INSTALL_LIBEXECDIR=libexec
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	rm -rf "$pkgdir"/usr/lib/systemd
}

sha512sums="
3530e40091f8072d47bdedd0cc2f53ebe5ec5a014aebf034877a0280a5935cd2f48fa3ecd343a47c58d4ef9458f142a895ec74668d49b258f8c99236d775f4dc  xdg-desktop-portal-kde-5.27.10.tar.xz
"
